#!/usr/bin/env ruby
# -*- coding: utf-8 -*-


require 'json'


HTML_DIR= Dir.pwd + "/html/"
POSTS_DIR= Dir.pwd + "/posts/"
DB_JSON= Dir.pwd + "/db.json"

require File.dirname(__FILE__) + '/app/json_helper.rb'
require File.dirname(__FILE__) + '/app/blog.rb'


arg0 =  ARGV[0]

param_keys = {
	"new"=>		"新建",
	"update"=>	"更新",
	"rm"=>		"删除文章",
	"ls"=>		"文章列表",
}


# 输出
if param_keys.include?(arg0) == false then
	layout = "%6s  %-20s\n"
	param_keys.each do |k, v|
   		printf(layout, k, v)
	end
	exit	
end

blog = Blog.new
blog.run ARGV[0]
